<template>
	<div class="container last_container">
		<el-table height="500" v-loading="tableLoading" :data="tableDatas" highlight-current-row>
			<el-table-column label="支付编号" align="center">
				<template slot-scope="scope">
					<div>{{ scope.row.pay_no || '--' }}</div>
				</template>
			</el-table-column>
			<el-table-column label="支付金额" align="center">
				<template slot-scope="scope">
					<div class="price">{{ scope.row.pay_money / 100 || 0 }}</div>
				</template>
			</el-table-column>
			<el-table-column property="pay_way" label="支付方式" align="center"></el-table-column>
			<el-table-column property="pay_state" label="支付状态" align="center"></el-table-column>
			<el-table-column property="pay_trade_type" label="支付类型" align="center"></el-table-column>
			<el-table-column label="支付时间" align="center">
				<template slot-scope="scope">
					<div>{{ scope.row.pay_time || '--' }}</div>
				</template>
			</el-table-column>
			<div slot="empty"><el-empty description=" "></el-empty></div>
		</el-table>
	</div>
</template>

<script>
const __name = 'wmzmall-order-pay';
export default {
	data() {
		return {
			dataId: '',
			tableLoading: false,
			tableDatas: []
		};
	},
	methods: {
		async loadData(callback) {
			this.tableLoading = true;
			await this.$db[__name]
				.noshopid()
				.noaction()
				.where({ order_id: this.dataId })
				.tolist({ loading: false })
				.then(res => {
					if (res.code == 200) {
						res.datas.forEach((row, idx) => {
							if (row.pay_time) {
								row.pay_time = new Date(row.pay_time).format();
							}
						});
						this.tableDatas = res.datas;
						
						if (typeof callback === 'function') {
							callback();
						}
					}
					this.tableLoading = false;
				});
		}
	},
	created() {
		this.dataId = this.$route.query.order_id || '';
		this.loadData();
		
		this.loadData(() => {
			this.$nextTick(() => {
				this.$api.scrollToStorage('.el-table__body-wrapper', this.$route.path + '-pay');
			});
		});
	},
	mounted() {
		this.$nextTick(() => {
			this.$api.scrollOnStorage('.el-table__body-wrapper', this.$route.path + '-pay');
		});
	}
};
</script>

<style></style>
